package com.t.HashMap;

import java.util.HashMap;

public class HashMapDemo {
    public static void main(String[] args) {
        Person p1=new Person("小王","男",18);
        Person p2=new Person("小张","女",17);
        Person p3=new Person("小明","男",20);
        HashMap hm=new HashMap();
        hm.put("s20099",p1);
        hm.put("s20034",p2);
        hm.put("s20015",60);
        System.out.println("集合的长度为："+hm.size());
        System.out.println("所有的key:"+hm.keySet());
        System.out.println("所有的values:"+hm.values());
        System.out.println("通过键取值："+hm.get("s20015"));
        System.out.println("判断值是否存在："+hm.containsValue(60));
        System.out.println("判断键是否存在:"+hm.containsKey("s20036"));
        System.out.println("获得所有的键关系:"+hm.clone());
    }
}
